const Koa = require("koa");
const app = new Koa();

const articleRouter = require("./router/article");

const cors = require("@koa/cors");
app.use(cors());
// app.use((ctx) => {
//   ctx.body = {
//     msg: "koa runing",
//   };
// });
const db = require("./db/index");
db();

const bodyParser = require("koa-bodyparser");
app.use(bodyParser());
const parameter = require("koa-parameter");
app.use(parameter(app));

app.use(articleRouter.routes());

app.listen(3000, () => {
  console.log("3000 running");
});
